


    ## WinBUGS code for a Varying-Intercept Model with Congress-Level Predictor  
    
    model {
    for (i in 1:N){
        Y[i] ~ dnorm(mu.y[i], tau.y)
        mu.y[i] <- alpha[congress[i]] + 
                   alpha1[member[i]] + 
                   beta[1]*X1[i] + 
                   beta[2]*X2[i] + 
                   beta[3]*X3[i] + 
                   beta[4]*X4[i] 
        }

        # priors
        for (i in 1:n.beta){
        beta[i] ~ dnorm(0, 0.1)
        }
        tau.y <- pow(sigma.y, -2)
        sigma.y ~ dunif(0, 10)

        for (k in 1:n.member){
        alpha1[k] ~ dnorm(0,0.1)
        }
        
        for (j in 1:J){
        alpha[j] ~ dnorm(mu.alpha[j], tau.alpha)
        mu.alpha[j] <- gamma[1] + 
                       gamma[2]*Z1[j] +
                       gamma[3]*Z2[j] + 
                       gamma[4]*Z3[j]        
        }
        tau.alpha <- pow(sigma.alpha, -2)
        sigma.alpha ~ dunif(0, 10)
        
        for (i in 1:n.gamma){
        gamma[i] ~ dnorm(0, 0.1)
        }

    }

